﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.IO;

namespace TimeReporter_II
{
    public class ProjectObject
    {
        private string _project;

        private ObservableCollection<TaskObject> _theTasks;

        public ProjectObject()
        {
            _theTasks = new ObservableCollection<TaskObject>();
        }

        public ProjectObject(FileInfo fi)
        {
            _project = ProjectObject.FileInfoToProjectName(fi);
            _theTasks = new ObservableCollection<TaskObject>();
        }

        public string project
        {
            get { return _project; }
            set { _project = value; }
        }

        public ObservableCollection<TaskObject> taskList
        {
            get { return _theTasks; }
            set { _theTasks = value; }
        }
        
        private static string FileInfoToProjectName(FileInfo fi)
        {
            char[] charArray2 = new char[] { '_' };
            string[] tmp = fi.Name.Split(charArray2);

            return tmp[0].Trim();
        }

    }
}
